package HashMapSort;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/*
ForEach EntrySet
 */
public class ForEntrySetTest {
  public static void main(String[] args) {
    // 创建并赋值 HashMap
    Map<Integer, String> map = new HashMap();
    map.put(1, "Java");
    map.put(2, "JDK");
    map.put(3, "Spring Framework");
    map.put(4, "MyBatis framework");
    map.put(5, "Java中文社群");
    // 遍历
    for (Map.Entry<Integer, String> integerStringEntry : map.entrySet()) {
      System.out.println(integerStringEntry.getKey());
      System.out.println(integerStringEntry.getValue());
    }
  }
}
